<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="vue.js"></script>
    <div id="app">
        <p>{{val}}</p>
        <button @click="cahnegVal()">button</button>

        <p>{{obj}}</p>
    </div>

    <script>
        var vm = new Vue({
            el: "#app",
            data: {
                val:"简单对象初始值",
                obj:{
                    name:"复杂对象name",
                    value:"复杂对象value",
                }
            },
            methods:{
                changeVal(){
                    this.val
                }

            },
            watch:{
                val:function(newval,oldval){
                    console.log(newval,oldval);
                    console.log(this.val)
                },
            }
        })
    </script>

</body>

</html>